/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package OLD;

import com.sun.lwuit.Form;
import com.sun.lwuit.MediaComponent;
import com.sun.lwuit.events.ActionListener;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.media.control.VideoControl;

/**
 *
 * @author nialldeasy
 */
public class Camera extends Menu {

    private MediaComponent mc = null;
    private Player player = null;
    private VideoControl vc = null;

    public Camera(ActionListener a) {
        super("Camera", a);

        setBackCommand("Main Menu");
        try {
            player = Manager.createPlayer("capture://video");
            player.realize();
            mc = new MediaComponent(player);
            this.anythingElseToAdd.addElement(mc);
            vc = (VideoControl) player.getControl("VideoControl");
            vc.setDisplayFullScreen(true);

        } catch (Exception e) {
        }




    }
  public void update(Form f) {
       f.repaint();

    }
    public void stop() {
        try {
            if(player!=null){
            player.stop();
            }
        } catch (MediaException ex) {
            ex.printStackTrace();
        }
    }

    public void start() {
        try {
            if(player!=null){
            player.start();
            }
            
        } catch (MediaException ex) {
            ex.printStackTrace();
        }
        

    }
}
